package com.zcsy.manage.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zcsy.manage.model.base.AppConfig;
import com.zcsy.manage.persistence.base.AppConfigDao;
import com.zcsy.manage.service.base.IAppConfigService;

/**
 * @Title: AppConfigServiceImpl.java
 * @Package： com.zcsy.manage.service.base 
 * @Description: 客户端小图片配置service层接口实现类
 *
 * @author caiyinli 13277030520@163.com
 * @Copyright: 2015 武汉中财数元信息技术有限公司 All rights reserved.
 * @date 2016年6月30日
 * @version 1.0
 * @see JDK1.7.0_75
 * @since
 */
@Service
public class AppConfigServiceImpl implements IAppConfigService {
	
	@Autowired
	private AppConfigDao appConfigDao;

	@Override
	public int insert(AppConfig record) {
		return appConfigDao.insert(record);
	}

	@Override
	public List<AppConfig> getAppConfigByKeyword(AppConfig appConfig) {
		return appConfigDao.getAppConfigByKeyword(appConfig);
	}

	@Override
	public int update(AppConfig appConfig) {
	    AppConfig oldInfo = appConfigDao.getAppConfigByPrimaryKey(appConfig.getId());
	    
	    oldInfo.setImgName(appConfig.getImgName());
	    oldInfo.setObjType(appConfig.getObjType());
	    oldInfo.setImgUrl(appConfig.getImgUrl());
	    oldInfo.setSort(appConfig.getSort());
	    oldInfo.setShopCategoryId(appConfig.getShopCategoryId());
	    
		return appConfigDao.update(oldInfo);
	}

	@Override
	public AppConfig getAppConfigByPrimaryKey(String id) {
		return appConfigDao.getAppConfigByPrimaryKey(id);
	}

}
